package com.smallA.controller;

import com.smallA.constant.AccessConstant;
import com.smallA.service.ExamQuestionService;
import org.springframework.security.access.annotation.Secured;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 获取考试对应信息控制器类
 */
@RestController
public class ExamineController {

    @Resource
    private ExamQuestionService examQuestionService;


    @RequestMapping("/Examine/getExam")
    @Secured(AccessConstant.STUDENT_ACCESS)
    public Object getExam(int eid) {
        Map<String, Object> map = examQuestionService.selectExamById(eid);
        return map;
    }

    @RequestMapping("/Examine/getQuestion")
    public Object getQuestion(){
        return examQuestionService.selectAllQuestion();
    }


    @RequestMapping("/Examine/add")
    public Object addExam(Integer[] choice, Integer[] fill, Integer[] shortAnswer, String analyze, int score,int tid){
        return examQuestionService.addExam(tid,analyze,choice,fill,shortAnswer,score);
    }
}
